-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HamzaMath #1702
base: master
Are you sure you want to change the base?
HamzaMath #1702
Conversation
some math blocks for calculators
You cant use eval, its dangerous and can run JS code. Also, the calculate blocks are useless as you can use the "abs" block from operators. You could just add the other blocks to the Math extension |
Oh yeeeah a message popping on your screen to simply say something is
sooooo dangerous. Sooooo many bad things could happen. It deeefinetely be
such a catastrophe.
…On Thu, Oct 3, 2024, 8:18 PM SharkPool ***@***.***> wrote:
You cant use eval, its dangerous and can run JS code.
alert("see what I mean?")
Also, the calculate blocks are useless as you can use the "abs" block from
operators. You could just add the other blocks to the Math extension
—
Reply to this email directly, view it on GitHub
<#1702 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANYWUKLD3ED7SEAPDQOBWXTZZXUGHAVCNFSM6AAAAABO6XO4G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJSGYYDCMJUGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You can run any script in JavaScript. It's an example. In reality you can download dangerous files or worse |
@Drago-Cuven now you're real silent |
@@ -0,0 +1,178 @@ | |||
(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be:
(function(Scratch) {
"use strict";
@@ -0,0 +1,178 @@ | |||
(function() { | |||
const extension = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your extension needs to be wrapped in a class, and its block functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually any object is fine lol
} | ||
}; | ||
|
||
Scratch.extensions.register(extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
Scratch.extensions.register(new SPAddedMotion());
})(Scratch);
try { | ||
const result = eval(args.EXPRESSION); | ||
return result; | ||
} catch (error) { | ||
return 'Error'; // Return error message for invalid expression | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should never be using eval like this. People will be able to run any javascript code, which is dangerous
some math blocks for calculators